import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

  const routes = [
	  {
		  path:'/',
		  redirect:'/indexs'
    },
    // {
		//   path:'/index',
		//   redirect:'/indexs'
    // },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    children:[
      {
        name:"index",
        path: '/indexs',
        component: resolve=>require(['../views/Index/index.vue'],resolve),
        meta:{
          keepAlive:true,
          y:0,
          needlogin:false,
        }
      },
      
    ] 
  },
  {
    name:"goodlist",
    path: '/goodlist',
    component: resolve=>require(['../views/Index/gootList.vue'],resolve),
    meta:{
      keepAlive:true,
      y:0,
      needlogin:false,
    }
  },
  {
    name:"searchpage",
    path: '/searchpage',
    component: resolve=>require(['../views/FuncPage/searchpage.vue'],resolve),
    meta:{
      keepAlive:true,
      y:0,
      needlogin:false,
    }
  },
  {
    path: '/pageleft',
    component: resolve=>require(['../views/FuncPage/pageleft.vue'],resolve),
    meta:{
      keepAlive:true,
      y:0,
      needlogin:false,
    }
  },
  {
    path: '/pageright',
    component: resolve=>require(['../views/FuncPage/pageright.vue'],resolve),
    meta:{
      keepAlive:true,
      y:0,
      needlogin:false,
    }
  },
  {
    path: '/pagediff',
    component: resolve=>require(['../views/FuncPage/pagediff.vue'],resolve),
    meta:{
      keepAlive:true,
      y:0,
      needlogin:false,
    }
  },
  {
    path: '/shopcart',
    component: resolve=>require(['../views/Cart/shoppingcart.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path: '/aftersale',
    component: resolve=>require(['../views/Aftersale/apply.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path: '/myCoupon',
    component: resolve=>require(['../views/Coupon/index.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path: '/getcou',
    component: resolve=>require(['../views/Coupon/getcou.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path: '/details',
    component: resolve=>require(['../views/Details/details.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:false,
    }
  },
  {
    path: '/goodrule',
    component: resolve=>require(['../views/Details/goodrule.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:false,
    }
  },
  {
    path: '/systemToolBar123',
    component: resolve=>require(['../views/ToolPage/clear.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:false,
    }
  },
  {
    path: '/systemwximg123',
    component: resolve=>require(['../views/ToolPage/WximgTest.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:false,
    }
  },
  {
    path: '/login',
    component: resolve=>require(['../views/Login/login.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:false,
    }
  },
  {
    path: '/login1',
    component: resolve=>require(['../views/Login/login1.vue'],resolve)
  },
  {
    path: '/reg',
    component: resolve=>require(['../views/Reg/reg.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:false,
    }
  },
  {
    path: '/password/update',
    component: resolve=>require(['../views/Password/Update.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path: '/password/forget',
    component: resolve=>require(['../views/Password/forget.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:false,
    }
  },
  {
    path: '/reg/confirm',
    component: resolve=>require(['../views/Reg/confirmpwd.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:false,
    }
  },
  {
    path: '/reg/UserAgreement',
    component: resolve=>require(['../views/Reg/UserAgreement.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:false,
    }
  },
  {
    path: '/bankapply',
    component: resolve=>require(['../views/Bank/apply.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path: '/applyList',
    component: resolve=>require(['../views/Bank/applyList.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path: '/banklist',
    component: resolve=>require(['../views/Bank/List.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path: '/getcash',
    component: resolve=>require(['../views/Bank/getcash.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path: '/addbank',
    component: resolve=>require(['../views/Bank/addbank.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path: '/order',
    component: resolve=>require(['../views/Order/order.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path: '/cartorder',
    component: resolve=>require(['../views/Cart/order.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path: '/orderDetail',
    component: resolve=>require(['../views/Order/orderDetail.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path:'/editaddress',
    component: resolve=>require(['../views/Address/editaddress.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path:'/manageaddress',
    component:resolve=>require(['../views/Address/manage.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path:'/MsgList',
    component:resolve=>require(['../views/Message/List.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path:'/MsgDetail',
    component:resolve=>require(['../views/Message/Detail.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path:'/UserSetting',
    component:resolve=>require(['../views/System/userSetting.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path:'/own',
    component:resolve=>require(['../views/System/own.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:false,
    }
  },
  {
    path:'/fillinlog',
    component:resolve=>require(['../views/System/Fillinlog.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path:'/AfterSalesDetails',
    component:resolve=>require(['../views/Order/AfterSalesDetails.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path:'/procenter',
    component:resolve=>require(['../views/Proxy/center.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path:'/proearndetail',
    component:resolve=>require(['../views/Proxy/earndetail.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path:'/recomcount',
    component:resolve=>require(['../views/Proxy/recomcount.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path:'/recomdetail',
    component:resolve=>require(['../views/Proxy/recomdetail.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path:'/earncount',
    component:resolve=>require(['../views/Proxy/earncount.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path:'/applyproxy',
    component:resolve=>require(['../views/Proxy/apply.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  {
    path:'/proxycode',
    component:resolve=>require(['../views/Proxy/code.vue'],resolve),
    meta:{
      keepAlive:false,
      y:0,
      needlogin:true,
    }
  },
  // {
  //   path: '/personal',
  //   component: resolve=>require(['../views/Personal/personal.vue'],resolve),
  //   meta:{
  //     keepAlive:false
  //   }
  // },
  // {
  //   path: '/personal/logistics',
  //   component: resolve=>require(['../views/Personal/logistics.vue'],resolve),
  //   meta:{
  //     keepAlive:false
  //   }
  // },
  // {
  //   path: '/personal/confirm',
  //   component: resolve=>require(['../views/Personal/confirm.vue'],resolve),
  //   meta:{
  //     keepAlive:false
  //   }
  // },
  // {
  //   path: '/personal/notreceiving',
  //   component: resolve=>require(['../views/Personal/notreceiving.vue'],resolve)
  // },
  // {
  //   path: '/personal/aftersales',
  //   component: resolve=>require(['../views/Personal/aftersales.vue'],resolve)
  // },
  // {
  //   path: '/personal/coupon/coupon',
  //   component: resolve=>require(['../views/Personal/coupon/coupon.vue'],resolve)
  // },
  // {
  //   path: '/editaddress1',
  //   component: resolve=>require(['../views/Address/editaddress1.vue'],resolve)
  // },
  // {
  //   path: '/personal/confirm',
  //   component: resolve=>require(['../views/Personal/confirm.vue'],resolve)
  // },
  // {
  //   path: '/personal/logistics',
  //   component: resolve=>require(['../views/Personal/logistics.vue'],resolve)
  // },
  // {
  //   path: '/reg111',
  //   component: resolve=>require(['../views/Reg/reg111.vue'],resolve)
  // },
  // {
  //   path: '/changepassword',
  //   component: resolve=>require(['../views/Personal/changepassword.vue'],resolve)
  // },
  // {
  //   path: '/passwordreset',
  //   component: resolve=>require(['../views/Password/passwordreset.vue'],resolve)
  // }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  scrollBehavior (to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      return { x: 0, y: to.meta.y }
    }
  },
  routes,
})

export default router
